package com.afdor.rws.event.channel.redis;

import lombok.NonNull;
import org.apache.commons.lang3.StringUtils;

/**
 * redis发布订阅模式工具类
 *
 * @author 悭梵
 * @date Created in 2018-08-17 11:20
 */
public class RedisUtils {

    /**
     * 队列名称
     *
     * @param eventSourceName
     * @return
     */
    public static String getQueueName(@NonNull String eventSourceName) {
        // redis 替换"."
        return "redis_queue_" + StringUtils.replace(eventSourceName, ".", "_");
    }

    /**
     * 重试队列名称
     *
     * @param eventSourceName
     * @return
     */
    public static String getRetryQueueName(@NonNull String eventSourceName) {
        // redis 替换"."
        return "redis_retry_queue_" + StringUtils.replace(eventSourceName, ".", "_");
    }
}
